<?php
use yii\helpers\Html;
$cid = Yii::$app->request->get('cid', 0);
$this->title = "产品";
?>
<div class="page-banner page-banner-product">
    <h1><?=Html::decode($this->title)?></h1>
</div>
<!--/page-banner-->
<ul class="box-main page-nav">
    <li><a href="<?= Yii::$app->homeUrl ?>"><?= Yii::$app->name ?></a></li>
    <li><span><?=Html::decode($this->title)?></span></li>
</ul>
<!--/page-nav-->
<div class="box-main box-white pa-15 clearfix">
    <div class="product-filter-title mb-15">
        <h3><i class="fa fa-list-ul"></i>分类选择</h3>
        <div class="search-product">
            <button class="btn"><i class="fa fa-search"></i></button>
            <div class="con">
                <input type="text" placeholder="搜索产品" class="txt">
            </div>
        </div>
    </div>
    <!--/product-filter-title-->
    <div class="product-filter mb-40">
        <div class="item">
            <div class="title">分类</div>
            <ul>
                <?php foreach ($productCate as $cate): ?>
                <li><a href="<?=Yii::$app->urlManager->createUrl(['product/index', 'cid'=>$cate['id']])?>" <?php if ($cid==$cate['id']) { echo ' class="active"';} ?> ><?=$cate['name']?></a></li>
                <?php endforeach; ?>
            </ul>
        </div>
        <!---->
        <!--<div class="item">
            <div class="title">国家</div>
            <ul>
                <li><a href="#" class="active">全部</a></li>
                <li><a href="#">美国</a></li>
                <li><a href="#">日本</a></li>
                <li><a href="#">中国</a></li>
            </ul>
        </div>-->
        <!---->
        <!--<div class="item">
            <div class="title">像素</div>
            <ul>
                <li><a href="#" class="active">全部</a></li>
                <li><a href="#">1080p</a></li>
                <li><a href="#">720p</a></li>
            </ul>
        </div>-->
        <!---->
    </div>
    <!--/product-filter-->
    <div class="title-gray mb-15">全部产品</div>
    <!--/title-gray-->
    <?php
    echo \yii\widgets\ListView::widget([
        'dataProvider' => $dataProvider,
        'options' => [
            'tag' => 'div',
            'class' => 'product-list row pt-15'
        ],
        'layout' => '{items}',
        'itemOptions' => [
            'tag' => 'div',
            'class' => 'item col-xs-12 col-md-4'
        ],
        'itemView' => '_item',
        'emptyText' => '<div class="no-record"><figure><img src="/uploads/no-record.png" alt=""></figure><h3>Ooops !</h3><p>未找到该产品，试试别的关键字？</p></div>',

//        'pager' => [
//            //'options'=>['class'=>'hidden']//关闭分页
//            'firstPageLabel' => "First",
//            'prevPageLabel' => 'Prev',
//            'nextPageLabel' => 'Next',
//            'lastPageLabel' => 'Last',
//        ]
    ]);

    echo \app\core\lib\GLinkPager::widget([
        'pagination' => $dataProvider->pagination,
        'options' => ['class' => 'pagination'],
        'maxButtonCount'=>10,
        'nextPageLabel'=>Yii::t('app','下一页'),
        'prevPageLabel'=>Yii::t('app','上一页'),
        'firstPageLabel' => '首页',
        'lastPageLabel' => '尾页'
    ]);
    ?>
    <!--/product-list-->
    <!--/pagination-->
</div>
<!--/box-main-->